//
//  DBJDoctorListModel.m
//  DBJ
//
//  Created by 简楚君 on 2016/11/15.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "DBJDoctorListModel.h"
#import "DBJNetworkTool.h"
#import <YYModel.h>

@implementation DBJDoctorListModel

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{}

+(void)getDoctorListDataWithURLString:(NSString *)URLString andParameters:(NSDictionary *)parameters andSuccessBlock:(void(^)(NSArray *newsList))successBlock andErrorBlock:(void(^)(NSError *error))errorBlock{
    
    [[DBJNetworkTool sharedNetworkTool] POSTWithURLString:URLString parameters:parameters success:^(id responseObject) {
        // 解析json数据
        NSDictionary *jsons = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
        //获取需要的字典数组
        NSArray *dictArr = jsons[@"data"];
        // 使用YYModel把字典数组转模型数组
        NSArray *newsList = [NSArray yy_modelArrayWithClass:[DBJDoctorListModel class] json:dictArr];
        if (successBlock) {
            successBlock(newsList);
        }
    } faile:^(NSError *error) {
        if (errorBlock) {
            errorBlock(error);
        }
    }];
}
@end
